# -*- coding: UTF-8 -*-
from datetime import datetime
import json
import re
from functools import reduce
import ast

from config.default_settings import mysql_database_bzx
from utils.mysql_util import MysqlHelper
from utils.sqlite3_util import Sqlite3Helper

if __name__ == '__main__':
    data_ist =["/push/post_00003_i", "/push/post_00004_i", "/push/post_00008_i", "/push/post_00014_i", "/push/post_00013_i", "/push/post_00002_i", "/push/post_00010_i", "/push/post_00011_i", "/push/post_00012_i", "/push/post_00015_i", "/push/post_00001_i", "/push/post_00005_i", "/push/post_00009_i", "/push/post_00006_i", "/push/post_00007_i", "/push/re_convert_receive_data"]

    mysql_helper = MysqlHelper(mysql_database_bzx)
    max_num_list = mysql_helper.get_list("SELECT count(id) as id FROM `bzx_service_2000`.`function_url_mapping` ")
    max_num = max_num_list[0].get("id");
    print(max_num)
    if not max_num:
        print("跳过----")
    max_num = int(max_num)
    sql_template = "INSERT INTO `function_url_mapping` (`id`, `url`, `function_name`, `module_id`, `module_name`, `create_time`, `update_time`, `creater`, `updater`, `mof_div_code`, `fiscal_year`, `is_deleted`) VALUES ('{id}', '{url}', '{function_name}', '{module_id}', '{module_name}', '2025-08-12 15:54:21', '2025-08-12 15:54:21', '1', '1', '630000000', '2025', 2);"
    for item in data_ist:
        max_num = max_num + 1
        sql = sql_template.format(id=max_num,url = item,function_name="业务协同",module_id = "7E8531987D95489083AA8CD02F0A7B69",module_name="智能协办")
        mysql_helper.execute_sql(sql)
        print(sql)
